import { CheckoutInfo } from '@/types/checkout'
import { ApiRes } from '@/types/data'
import request from '@/utils/request'
import { defineStore } from 'pinia'

const useCheckoutStore = defineStore({
  id: 'checkout',
  state: () => ({
    checkoutInfo: {} as CheckoutInfo
  }),
  actions: {
    async getCheckoutInfo() {
      const res = await request.get<ApiRes<CheckoutInfo>>('/member/order/pre')
      this.checkoutInfo = res.data.result
    }
  }
})

export default useCheckoutStore
